package com.sk.skplanet.commute.views;

import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sk.skplanet.commute.R;
import com.sk.skplanet.commute.controllers.PointController;
import com.sk.skplanet.commute.dao.PointDao;
import com.sk.skplanet.commute.vo.Data;
import com.sk.skplanet.commute.vo.PointVo;
import com.sk.skplanet.commute.vo.RouteVo;

public class PointList extends Activity {
	Intent intentRouteList;
	RouteVo routeVo;
	TextView textview_pointlist_title;
	LinearLayout layout_pointlist;
	RelativeLayout layout_pointlist_title;
	List<PointVo> list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pointlist);


		
		layout_pointlist_title = (RelativeLayout) findViewById(R.id.layout_pointlist_title);
		layout_pointlist = (LinearLayout) findViewById(R.id.layout_pointlist);
		layout_pointlist_title.setBackgroundColor(Color.parseColor(Data.layout_pointlist_titleColor));
		layout_pointlist.setBackgroundColor(Color.parseColor(Data.layout_pointColor));

		list = PointDao.selectPoint();

		textview_pointlist_title = (TextView) findViewById(R.id.textview_pointlist_title);

		intentRouteList = getIntent();
		routeVo = (RouteVo) intentRouteList.getSerializableExtra("routeVo");

		textview_pointlist_title.setText(routeVo.getName());
		textview_pointlist_title.setTextColor(Color.parseColor(Data.textview_pointColor));

		for (PointVo pointVo : list) {
			if (routeVo.getId() == pointVo.getRoute_id()) layout_pointlist.addView(PointController.makePoint(this,
					pointVo));

		}

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.favorite_menu, menu);
		return true;
	}

}
